namespace LS.Digitize
{
    public struct WriteDictionaryKeyScope: IScope
    {
        public IWriter Writer { get; private set; }
        public int Index { get; private set; }
        
        public WriteDictionaryKeyScope(IWriter writer, int index)
        {
            Writer = writer;
            Index = index;
            writer.StartWriteDictionaryKey(Index);
        }
        
        public void Dispose()
        {
            Writer.EndWriteDictionaryKey(Index);
            Writer = null;
            Index = 0;
        }
    }
}